package com.elm.orderDetailet.controller;


import com.elm.common.pojo.Result;
import com.elm.orderDetailet.pojo.OrderDetailet;
import com.elm.orderDetailet.service.OrderDetailetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/orderDetailet")
public class OrderDetailetController {

    @Autowired
    private OrderDetailetService orderDetailetService;

    @PostMapping("/create")
    public Result orderDetailetCreate(@RequestBody OrderDetailet orderDetailet){
        orderDetailetService.orderDetailetCreate(orderDetailet);
        return Result.success();
    }

    @GetMapping("/getByOrderId")
    public Result<List<OrderDetailet>> getByOrderId(Integer orderId){
        List<OrderDetailet> list = orderDetailetService.getByOrderId(orderId);
        return Result.success(list);
    }
}
